package com.chengjj.kings.core.reqres.response;

/**
 * @Author: 成俊杰
 * @CreateDate: 2019/3/7
 * @Version: 1.0
 * @Description:
 */
public class ResponseData {
    public static final String DEFAULT_SUCCESS_MESSAGE = "请求成功";
    public static final String DEFAULT_ERROR_MESSAGE = "网络异常";
    public static final Integer DEFAULT_SUCCESS_CODE = 200;
    public static final Integer DEFAULT_ERROR_CODE = 500;
    private Boolean success;
    private Integer code;
    private String message;
    private Object data;

    public ResponseData() {

    }

    public ResponseData(Boolean success, Integer code, String message, Object data) {
        this.success = success;
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    @Override
    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof ResponseData)) {
            return false;
        } else {
            ResponseData other = (ResponseData) o;
            label01:
            {
                Object this$success = this.getSuccess();
                Object other$success = other.getSuccess();
                if (this$success == null) {
                    if (other$success == null) {
                        break label01;
                    }
                } else if (this$success.equals(other$success)) {
                    break label01;
                }
                return false;
            }
            Object this$code = this.getCode();
            Object other$code = other.getCode();
            if (this$code == null) {
                if (other$code == null) {
                    return false;
                }
            } else if (!this$code.equals(other$code)) {
                return false;
            }
            Object this$message = this.getMessage();
            Object other$message = other.getMessage();
            if (this$message == null) {
                if (other$message != null) {
                    return false;
                }
            } else if (!this$message.equals(other$message)) {
                return false;
            }

            Object this$data = this.getData();
            Object other$data = other.getData();
            if (this$data == null) {
                if (other$data != null) {
                    return false;
                }
            } else if (!this$data.equals(other$data)) {
                return false;
            }

            return true;
        }
    }

    @Override
    public int hashCode() {
        int result = 1;
        Object $success = this.getSuccess();
        result = result * 59 + ($success == null ? 43 : $success.hashCode());
        Object $code = this.getCode();
        result = result * 59 + ($code == null ? 43 : $code.hashCode());
        Object $message = this.getMessage();
        result = result * 59 + ($message == null ? 43 : $message.hashCode());
        Object $data = this.getData();
        result = result * 59 + ($data == null ? 43 : $data.hashCode());
        return result;
    }

    @Override
    public String toString() {
        return "ResponseData{" +
                "success=" + success +
                ", code=" + code +
                ", message='" + message + '\'' +
                ", data=" + data +
                '}';
    }
}
